package com.ufo.dis.service.service.impl;

import com.ufo.dis.service.common.utils.PageUtils;
import com.ufo.dis.service.common.utils.Query;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.ufo.dis.service.dao.UserDao;
import com.ufo.dis.service.entity.UserEntity;
import com.ufo.dis.service.service.UserService;


@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<UserEntity> page = this.page(
                new Query<UserEntity>().getPage(params),
                new QueryWrapper<UserEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public Boolean logintf(UserEntity user) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("username", user.getUsername());
        queryWrapper.eq("password", user.getPassword());
        UserEntity userEntity = baseMapper.selectOne(queryWrapper);
        if(userEntity!=null) {
            return true;
        }
        else{
            return false;
        }

    }

}